<?php
namespace Mobile\Controller;
use Think\Controller;
class DefaultController extends Controller{
    public function login(){
     if(empty($_POST)){
         $this->display();
         exit;
     }
    $data['mobile']=$_POST['mobile'];
    $data['password_hash']=md5($_POST['pwd']);
    $model=M('member');
        $res=$model->where($data)->find();
        if($res){
            $_SESSION['mobile']['id']=$res['id'];
            $_SESSION['mobile']['mobile']=$data['mobile'];
            $this->redirect('Index/index');
        }else{
            $this->error('登陆失败');
        }
    }
}
